package bravo;
import java.util.*;

/**
 * Write a description of class OperadorComposite here.
 * 
 * @author (your name) 
 * @version (a version number or a date)
 */
public class OperadorComposite implements OperadorComponent
{
    // instance variables - replace the example below with your own
    private List<OperadorComponent> operadoresComponents = new ArrayList<OperadorComponent>();

    /**
     * Constructor for objects of class OperadorComposite
     */
    public OperadorComposite()
    {
        // initialise instance variables
    }

    /**
     * An example of a method - replace this comment with your own
     * 
     * @param  y   a sample parameter for a method
     * @return     the sum of x and y 
     */
    public void add(ConversorBase conversor, String operador) {
        // put your code here        
        operadoresComponents.add(new OperadorLeaf(conversor,operador));
    }
    
    public String operadorNaBaseFinal(ConversorBase conversorFinal) {
        String resultado = "";
        
        for(OperadorComponent folha : operadoresComponents){
            resultado = resultado + folha.operadorNaBaseFinal(conversorFinal);
        }
        return resultado;
    }
}
